{% extends "base.html" %}
{% load slots %}
{% load i18n %}
{% load miraflores_tags %}
{% load markup %}
{% load comments %}

{% block title %}{{ site.name }} -- {{ object.title }}{% endblock %}

{% block extrahead %}
<link href="{% url miraflores_syndication "rss" %}" type="application/rss+xml" rel="alternate" title="{{ site.name }} RSS Feed" />
<link href="{% url miraflores_syndication "atom" %}" type="application/atom+xml" rel="alternate" title="{{ site.name }} Atom Feed" />
{% if user.username %}
  <link href="{% url miraflores_syndication "rss" %}{% feed_user_token user %}/" type="application/rss+xml" rel="alternate" title="{{ site.name }} RSS Feed for {{ user.username }}" />
  <link href="{% url miraflores_syndication "atom" %}{% feed_user_token user %}/" type="application/atom+xml" rel="alternate" title="{{ site.name }} Atom Feed for {{ user.username }}" />
{% endif %}
<script type="text/javascript" src="{{ MEDIA_URL }}{{ jquery_url }}"></script>
{% endblock %}

{% block extrastyle %}
<style type="text/css">
  .comment-main {
    padding-left: 12px;
    padding-right: 12px;
    border-left: 3px solid #ccc;
   }
   .comment {
     padding-bottom: 12px;
   }
</style>
{% endblock %}

{% block userlinks %}
{% define_slot com.djangoproject.base.userlinks %}
{% endblock %}

{% block nav-global %}
{% define_slot com.djangoproject.base.nav-global %}
{% endblock %}

{% block breadcrumbs %}
<div class="breadcrumbs">
<a href="/">{% trans 'Home' %}</a> &rsaquo;
<a href="{% url miraflores_blog_entry_list %}">{% trans 'Blog' %}</a> &rsaquo;
<a href="{% url miraflores_blog_entry_archive_by_year object.last_updated.year %}">{{ object.last_updated.year }}</a> &rsaquo;
<a href="{% url miraflores_blog_entry_archive_by_month object.last_updated.year,object.last_updated.month %}">{{ object.last_updated.month }}</a> &rsaquo;
<a href="{% url miraflores_blog_entry_archive_by_day object.last_updated.year,object.last_updated.month,object.last_updated.day %}">{{ object.last_updated.day }}</a> &rsaquo;
{{ object.title }}
</div>
{% endblock %}

{% block content_title %}<h1>{{ object.title }}</h1>{% endblock %}

{% block content %}
{% block object-tools %}
{% define_slot com.djangoproject.base.object-tools %}
{% endblock %}
<div id="content-main">
	<div class="entry">
	    {% if not object.published %}
	    <div class="system-message">
	      <p class="system-message-title">Unpublished Entry</p>
	      <p>{% trans "This entry is unpublished. It is only visible to staff members." %}</p>
	    </div>
	  {% endif %}
	  {% if object.limit_access %}
	    <div class="system-message">
	      <p>{% trans "This entry is not visible to the general public. It requires special permission to view." %}</p>
	    </div>
	  {% endif %}
	  {% if comment_message %}
	    <div class="system-message">
	      <p>{{ comment_message }}</p>
	    </div>
	  {% endif %}
	  <div class="entry_body">
	  {{ object.body|markdown }}
	  </div>
	  <div class="entry_footer">
	  	<p class="entry_published_date">{% blocktrans with object.last_updated|date:"N j, Y P" as last_updated %}Published {{ last_updated }}{% endblocktrans %}</p>
	    <p class="entry_citation"><cite>{% blocktrans with object.author.first_name as first_name and object.author.last_name as last_name and object.author.email as email %}
	    By <a href="mailto:{{ email }}">{{ first_name }} {{ last_name }}</a>
	    {% endblocktrans %}</cite></p>
	    <p class="entry_categories">Categories: {% for category in entry.categories.all %}<a href="{% url miraflores_categorized_entry_list category.slug %}">{{ category.name }}</a> {% empty %}<em>{% trans 'Uncategorized' %}</em>{% endfor %}</p>
	    <p class="entry_tags">Tags: {% for tag in object.tags %}<a href="{% url miraflores_tagged_entry_list tag %}">{{ tag }}</a> {% empty %}<em>{% trans 'No tags' %}</em>{% endfor %}</p>
	    {% define_slot net.skwx.cubalibre.miraflores.SharingOptions %}	      
	  </div>
	</div>
	<hr />
    {% get_comment_form for object as form %}
    <form action="{% comment_form_target %}" method="post">
    <input type="hidden" name="next" value="{{ object.get_absolute_url }}" />
    {{ form.content_type }}{{ form.object_pk }}{{ form.timestamp }}{{ form.security_hash }}
    <p style="display: none">{{ form.honeypot.label_tag }}{{ form.honeypot }}</p>
	<table class="module" id="commentform">
	  <caption>{% trans "Submit comment" %}</caption>
	  <tr {% if form.name.errors %}class="error"{% endif %}>
	  	<th scope="row"><label for="id_name">{% trans "Your name" %}</label></th>
	  	<td>{{ form.name.errors }}{% if user.is_authenticated %}{{ user.first_name }} {{ user.last_name }}<input type="hidden" name="name" value="{{ user.first_name }}{{ user.last_name }}" />{% else %}{{ form.name }}{% endif %}</td>
	  </tr>
	  <tr {% if form.email.errors %}class="error"{% endif %}>
	  	<th scope="row"><label for="id_email">{% trans "Your email" %}</label></th>
	  	<td>{{ form.email.errors }}{% if user.is_authenticated %}{{ user.email }}<input type="hidden" name="email" value="{{ user.email }}" />{% else %}{{ form.email }}{% endif %}</td>
	  </tr>
	  <tr {% if form.url.errors %}class="error"{% endif %}>
	  	<th scope="row"><label for="id_url">{% trans "Your website (optional)" %}</label></th>
	  	<td>{{ form.url.errors }}{{ form.url }}</td>
	  </tr>
	  <tr {% if form.comment.errors %}class="error"{% endif %}>
	    <th scope="row"><label for="id_comment">{% trans "Your thoughts" %}</label></th>
	    <td>{{ form.comment.errors }}{{ form.comment }}</td>
	  </tr>	  	
	</table>
	<p class="submit">
      <input type="submit" name="post" class="submit-post" value="{% trans "Post" %}" />
      <input type="submit" name="preview" class="submit-preview" value="{% trans "Preview" %}" />
    </p>
	</form>
	<hr />
	{% get_comment_list for object as comment_set %}
	{% if comment_set %}<h3>Comments</h3>{% endif %}
	<div class="commentlist">
		{% for comment in comment_set %}
		  <div class="comment"><a name="c{{ forloop.counter }}"></a>
		    <div class="comment-main">{{ comment.comment|markdown|sanitize:"p a:href br ul ol li strong em b i"|safe }}</div>
		  	<p><cite><a href="#c{{ forloop.counter }}">#{{ forloop.counter }}</a> Posted {{ comment.submit_date|date:"N j, Y P" }} by
		  	{% if comment.userinfo.url %}
		  	<a href="{{ comment.userinfo.url|escape }}">{{ comment.userinfo.name|escape }}</a>
		  	{% else %}
		  	{{ comment.userinfo.name|escape }}
		  	{% endif %}
		  	{% if comment.userinfo.email %}({{ comment.userinfo.email|obfuscate_email|escape}}){% endif %}
		  	</cite></p>
		  </div>
		{% endfor %}
	</div>		  
</div>
{% endblock %}

{% block sidebar %}
{% define_slot com.djangoproject.base.content-related %}
{% endblock %}